home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / INTERVIE / RUBRECT.H < prev    next >
C/C++ Source or Header  |  1980-01-03  |  4KB  |  125 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * Rubberbanding for rectangles.
  25.  */
  26.  
  27. #ifndef rubrect_h
  28. #define rubrect_h
  29.  
  30. #include <InterViews/rubband.h>
  31.  
  32. class RubberRect : public Rubberband {
  33. public:
  34.     RubberRect(
  35.         Painter*, Canvas*, Coord x0, Coord y0, Coord x1, Coord y1,
  36.     Coord offx = 0, Coord offy = 0
  37.     );
  38.  
  39.     virtual void GetOriginal(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  40.     virtual void GetCurrent(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  41.     virtual void Draw();
  42. protected:
  43.     Coord fixedx, fixedy;
  44.     Coord movingx, movingy;
  45. };
  46.  
  47. class RubberSquare : public RubberRect {
  48. public:
  49.     RubberSquare(
  50.         Painter*, Canvas*, Coord x0, Coord y0, Coord x1, Coord y1,
  51.     Coord offx = 0, Coord offy = 0
  52.     );
  53.  
  54.     virtual void GetCurrent(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  55. };
  56.  
  57. class SlidingRect : public RubberRect {
  58. public:
  59.     SlidingRect(
  60.         Painter*, Canvas*, Coord x0, Coord y0, Coord x1, Coord y1, 
  61.     Coord rfx, Coord rfy, Coord offx = 0, Coord offy = 0
  62.     );
  63.  
  64.     virtual void GetCurrent(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  65. protected:
  66.     Coord refx;
  67.     Coord refy;
  68. };
  69.  
  70. class StretchingRect : public RubberRect {
  71. public:
  72.     StretchingRect (
  73.         Painter*, Canvas*, Coord x0, Coord y0, Coord x1, Coord y1, Side s,
  74.     Coord offx = 0, Coord offy = 0
  75.     );
  76.  
  77.     virtual void GetCurrent(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  78.     float CurrentStretching();
  79. protected:
  80.     Side side;
  81. };
  82.  
  83. class ScalingRect : public RubberRect {
  84. public:
  85.     ScalingRect(
  86.         Painter*, Canvas*, Coord x0, Coord y0, Coord x1, Coord y1,
  87.     Coord cx, Coord cy, Coord offx = 0, Coord offy = 0
  88.     );
  89.  
  90.     virtual void GetCurrent(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  91.     float CurrentScaling();
  92. protected:
  93.     Coord centerx, centery;
  94.     int width, height;
  95. };
  96.  
  97. class RotatingRect : public Rubberband {
  98. public:
  99.     RotatingRect(
  100.         Painter*, Canvas*, Coord x0, Coord y0, Coord x1, Coord y1, 
  101.     Coord cx, Coord cy, Coord rfx, Coord rfy, 
  102.     Coord offx = 0, Coord offy = 0
  103.     );
  104.  
  105.     virtual void Draw();
  106.     virtual void GetOriginal(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  107.     virtual void GetCurrent(
  108.         Coord& leftbotx, Coord& leftboty,
  109.     Coord& rightbotx, Coord& rightboty,
  110.     Coord& righttopx, Coord& righttopy,
  111.     Coord& lefttopx, Coord& lefttopy
  112.     );
  113.     float CurrentAngle();
  114. protected:
  115.     void Transform (
  116.     Coord& x, Coord& y,
  117.     double a0, double a1, double b0, double b1, double c0, double c1
  118.     );
  119. protected:
  120.     Coord left, right, centerx, refx;
  121.     Coord bottom, top, centery, refy;
  122. };
  123.  
  124. #endif
  125.